package com.qing.web_freemarke.controller;

import com.qing.web_freemarke.aspect.WebLog;
import com.qing.web_freemarke.entity.WebLogEntity;
import com.qing.web_freemarke.entity.WebLogVO;
import com.qing.web_freemarke.service.weblog.WebLogService;
import com.qing.web_freemarke.util.PageResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
@RequestMapping("/web-log")
public class WebLogController {

	@Autowired
	private WebLogService webLogService;

	@WebLog
	@PostMapping("/page")
	public PageResultInfo<WebLogEntity> getLogPage(@RequestBody WebLogVO webLogVO) {
		return webLogService.findWebLogPage(webLogVO);
	}


	@GetMapping
	public ModelAndView getLogPage(ModelAndView modelAndView) {
		modelAndView.setViewName("/log/WebLog");
		return modelAndView;
	}

}
